<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <button @click="fn">点我</button>
    </div>

    <script src="./vue.js"></script>
    <script>
        // 产生一个vue实例
        new Vue({
            el: '#app',
            // vue实例会在创建的某个阶段里把data中的数据和methods中的方法
            // 全部挂载到当前实例的最外层
            data() {
                return {
                    msg: '你好',
                    age: 16
                }
            },
            
            methods: {
                fn () {
                    console.log(this)
                    console.log(this.msg)
                    console.log(this.age)
                    this.fn2()
                },

                fn2 () {
                    console.log('我是fn2')
                }
            }
        })
    </script>
</body>
</html>